/**
 * 入口js
 * @file
 * @author mano233
 * @date 2019-03-25
*/

import Vue from 'vue';
import App from './App';
import apis from './http';
import Store from './store';
import Router from './router';

import enquire from 'enquire.js'; // 媒体查询插件
import VueLazyLoad from 'vue-lazyload'; // 懒加载插件
import InfiniteScroll from 'vue-infinite-scroll'; // 无限加载插件


// 第三方ui库
import Antd from 'ant-design-vue';
import {message} from 'ant-design-vue';
import 'ant-design-vue/dist/antd.min.css';

// css
import '@/assets/css/global.css';
import 'csshake';

// 自定义组件
import MyCard from '@/components/card/Card';
import MyCardTitle from '@/components/card/CardHasTitle';
import MyButton from '@/components/BtnCustom';

Vue.config.productionTip = false;
Vue.use(apis);
Vue.use(Antd);
Vue.use(VueLazyLoad);
Vue.use(InfiniteScroll);
Vue.prototype.$enquire = enquire;

// 注册全局组件
Vue.component('my-card', MyCard);
Vue.component('my-card-title', MyCardTitle);
Vue.component('my-button', MyButton);
Vue.prototype.$message = message;

const localData = localStorage.getItem('loginUser');

if (localData) {
    Store.commit('createUser', JSON.parse(localData));
}

export default new Vue({
    el: '#app',
    router: Router, // 引入路由
    store: Store, // 引入 Vuex
    render: (h) => h(App),
});
